<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserGroupXUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_group_x_users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')       ->default(0)->comment('加入拼团的用户');
            $table->bigInteger('user_group_id') ->default(0)->comment('加入的团');
            $table->decimal('pay_amount')       ->default(0)->comment('支付的价格');
            $table->integer('status')           ->default(0)->comment('状态0已加入，1已支付，2已完成，3拼团失败');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_group_x_users');
    }
}
